<template>
  <div style="min-width: 1000px;">

      <!--  路由页面展示部分-->
      <router-view/>
<!--  提示部分-->
    <el-dialog title="提示" :visible.sync="this.$store.state.IS_SHOW_MESSAGE" :before-close="handleClose" width="30%" style="min-width: 400px">
      <span>{{this.$store.state.GLOBAL_MESSAGE}}</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel()">取消</el-button>
        <el-button type="success" @click="closeGlobalMessage()" >{{this.$store.state.YES}}</el-button>
      </span>
    </el-dialog>

<!--普通消息-->
    <el-dialog title="提示" :visible.sync="this.$store.state.IS_SHOW_COMMON_MESSAGE" :before-close="handleCloseCommon" width="30%" style="min-width: 400px;text-align: left">
      <span style="float: left">{{this.$store.state.GLOBAL_COMMON_MESSAGE}}</span>
      <span slot="footer" class="dialog-footer"><el-button type="success" @click="closeGlobalCommonMessage()">确 定</el-button></span>
    </el-dialog>


  </div>
</template>

<script>


import Login from "@/components/common/login";
export default {
  components: {Login},
  data() {
    return {

    }
  },
  created() {
    if (this.$store.state.IS_LOGIN === '-1') {
      // 检查当前路径是否已经是目标路径
      if (this.$router.currentRoute.path !== '/login') {
        this.$router.push('/login');
      }
    }
  },
  methods: {
//用户点击×按钮关闭通用提示框
    handleCloseCommon(){
      this.$store.state.IS_SHOW_COMMON_MESSAGE = false;
    },
    //用户点击确认按钮关闭通用提示框
    closeGlobalCommonMessage()
    {
      this.$store.state.IS_SHOW_COMMON_MESSAGE = false
    },

    //用户点击×按钮关闭链接跳转提示框
    handleClose() {
      this.$store.state.IS_SHOW_MESSAGE = false;
    },
    //用户点击提示框确认的操作:指定跳转
    closeGlobalMessage() {
      this.$store.state.IS_SHOW_MESSAGE = false;
      if (this.$route.path !== this.$store.state.GLOBAL_MESSAGE_LINK)
      {
        this.$router.push(this.$store.state.GLOBAL_MESSAGE_LINK);
      }
    },
    //点击取消按钮的操作
    cancel(){
      this.$store.state.IS_SHOW_MESSAGE = false;
    }
  },
  mounted() {

  }

};

</script>
